
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>2.3 CKAD认证中的部署教程 · Kubernetes - 痴者工良</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="痴者工良">
        
        
    
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-insert-logo/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-advanced-emoji/emoji-website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    


    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="4.kubeadm_proxy.html" />
    
    
    <link rel="prev" href="2.kubeadm.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://www.whuanle.cn" target="_blank" class="custom-link">痴者工良的博客</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    文档说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../1.basic/">
            
                <a href="../1.basic/">
            
                    
                    1.基础知识
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../1.basic/">
            
                <a href="../1.basic/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../1.basic/1.docker.html">
            
                <a href="../1.basic/1.docker.html">
            
                    
                    1.1 说透 Docker：基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../1.basic/2.virtual.html">
            
                <a href="../1.basic/2.virtual.html">
            
                    
                    1.2 说透 Docker： 虚拟化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../1.basic/3.docker_network.html">
            
                <a href="../1.basic/3.docker_network.html">
            
                    
                    1.3 了解 Docker 网络
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../1.basic/4.pod_docker.html">
            
                <a href="../1.basic/4.pod_docker.html">
            
                    
                    1.4 Docker 和 Pod
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../1.basic/5.k8s.html">
            
                <a href="../1.basic/5.k8s.html">
            
                    
                    1.5 K8S入门基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="./">
            
                <a href="./">
            
                    
                    2.部署和配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="2.deploy.md">
            
                <span>
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="1.minikube.html">
            
                <a href="1.minikube.html">
            
                    
                    2.1 使用 Minikube 部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="2.kubeadm.html">
            
                <a href="2.kubeadm.html">
            
                    
                    2.2 使用 kubeadm 部署
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.4" data-path="3.kubeadm_ckad.html">
            
                <a href="3.kubeadm_ckad.html">
            
                    
                    2.3 CKAD认证中的部署教程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="4.kubeadm_proxy.html">
            
                <a href="4.kubeadm_proxy.html">
            
                    
                    2.4 国内代理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="5.dashboard.html">
            
                <a href="5.dashboard.html">
            
                    
                    2.5 Dashboard
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../3.pod/">
            
                <a href="../3.pod/">
            
                    
                    3.Pod部署和调度
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../3.pod/">
            
                <a href="../3.pod/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../3.pod/1.pod.html">
            
                <a href="../3.pod/1.pod.html">
            
                    
                    3.1 Pod
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../3.pod/2.deployment.html">
            
                <a href="../3.pod/2.deployment.html">
            
                    
                    3.2 Deployment部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../3.pod/3.replica.html">
            
                <a href="../3.pod/3.replica.html">
            
                    
                    3.3 副本集(ReplicaSet)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../3.pod/4.pod_network.html">
            
                <a href="../3.pod/4.pod_network.html">
            
                    
                    3.34 Pod 端口映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../3.pod/5.update.html">
            
                <a href="../3.pod/5.update.html">
            
                    
                    3.5 Pod 升级、回滚
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../3.pod/6.scale.html">
            
                <a href="../3.pod/6.scale.html">
            
                    
                    3.6 Pod 缩放
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../3.pod/7.lable.html">
            
                <a href="../3.pod/7.lable.html">
            
                    
                    3.7.Pod 标签
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../3.pod/8.schedule.html">
            
                <a href="../3.pod/8.schedule.html">
            
                    
                    3.8 Pod 调度
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../3.pod/9.jobs_cronjobs.html">
            
                <a href="../3.pod/9.jobs_cronjobs.html">
            
                    
                    3.9 Jobs、CronJobs
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../4.network/">
            
                <a href="../4.network/">
            
                    
                    4.Kubernetes 网络
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../4.network/">
            
                <a href="../4.network/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../4.network/1.network.html">
            
                <a href="../4.network/1.network.html">
            
                    
                    4.1 Kubernetes 网络
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../4.network/2.endpoint.html">
            
                <a href="../4.network/2.endpoint.html">
            
                    
                    4.2 Endpoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../4.network/3.ingress.html">
            
                <a href="../4.network/3.ingress.html">
            
                    
                    4.3 ingress
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../4.network/4.discovery.html">
            
                <a href="../4.network/4.discovery.html">
            
                    
                    4.4 服务发现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../5.volumes/">
            
                <a href="../5.volumes/">
            
                    
                    5.volumes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../5.volumes/">
            
                <a href="../5.volumes/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../5.volumes/1.volumes.html">
            
                <a href="../5.volumes/1.volumes.html">
            
                    
                    5.1 卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../5.volumes/2.secret_configmap.html">
            
                <a href="../5.volumes/2.secret_configmap.html">
            
                    
                    5.2 secret 和 ConfigMap 卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../5.volumes/3.nfts.html">
            
                <a href="../5.volumes/3.nfts.html">
            
                    
                    5.3 NFS卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../5.volumes/4.pv_pvc.html">
            
                <a href="../5.volumes/4.pv_pvc.html">
            
                    
                    5.4 持久化卷
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../6.api_safe/">
            
                <a href="../6.api_safe/">
            
                    
                    6.API 和 安全
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../6.api_safe/">
            
                <a href="../6.api_safe/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../7.health/">
            
                <a href="../7.health/">
            
                    
                    7.维护和故障排除
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../8.health/README.md">
            
                <span>
            
                    
                    导读
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../k8s.html">
            
                <a href="../k8s.html">
            
                    
                    Kubernetes 命令概览
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../ckad.html">
            
                <a href="../ckad.html">
            
                    
                    CKAD 认证帮助
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >2.3 CKAD认证中的部署教程</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#23-ckad&#x8BA4;&#x8BC1;&#x4E2D;&#x7684;&#x90E8;&#x7F72;&#x6559;&#x7A0B;"><b></b>2.3 CKAD&#x8BA4;&#x8BC1;&#x4E2D;&#x7684;&#x90E8;&#x7F72;&#x6559;&#x7A0B;</a></li><ul><li><span class="title-icon "></span><a href="#&#x90E8;&#x7F72;"><b></b>&#x90E8;&#x7F72;</a></li><ul><li><span class="title-icon "></span><a href="#&#x9884;&#x8BBE;&#x7F51;&#x7EDC;"><b></b>&#x9884;&#x8BBE;&#x7F51;&#x7EDC;</a></li><li><span class="title-icon "></span><a href="#kubeadm-&#x5B89;&#x88C5;-k8s"><b></b>kubeadm &#x5B89;&#x88C5; k8s</a></li></ul><li><span class="title-icon "></span><a href="#&#x914D;&#x7F6E;-calico"><b></b>&#x914D;&#x7F6E; Calico</a></li><li><span class="title-icon "></span><a href="#&#x5176;&#x5B83;"><b></b>&#x5176;&#x5B83;</a></li><ul><li><span class="title-icon "></span><a href="#&#x5728;&#x8282;&#x70B9;&#x4E0A;&#x6267;&#x884C;&#x547D;&#x4EE4;"><b></b>&#x5728;&#x8282;&#x70B9;&#x4E0A;&#x6267;&#x884C;&#x547D;&#x4EE4;</a></li><li><span class="title-icon "></span><a href="#&#x81EA;&#x52A8;&#x8865;&#x5168;&#x5DE5;&#x5177;"><b></b>&#x81EA;&#x52A8;&#x8865;&#x5168;&#x5DE5;&#x5177;</a></li><li><span class="title-icon "></span><a href="#&#x72B6;&#x6001;&#x63CF;&#x8FF0;"><b></b>&#x72B6;&#x6001;&#x63CF;&#x8FF0;</a></li></ul></ul></ul></div><h1 id="23-ckad&#x8BA4;&#x8BC1;&#x4E2D;&#x7684;&#x90E8;&#x7F72;&#x6559;&#x7A0B;"><a name="23-ckad&#x8BA4;&#x8BC1;&#x4E2D;&#x7684;&#x90E8;&#x7F72;&#x6559;&#x7A0B;" class="anchor-navigation-ex-anchor" href="#23-ckad&#x8BA4;&#x8BC1;&#x4E2D;&#x7684;&#x90E8;&#x7F72;&#x6559;&#x7A0B;"><i class="fa fa-link" aria-hidden="true"></i></a>2.3 CKAD&#x8BA4;&#x8BC1;&#x4E2D;&#x7684;&#x90E8;&#x7F72;&#x6559;&#x7A0B;</h1>
<p>&#x5728;&#x4E0A;&#x4E00;&#x7AE0;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x5B66;&#x4F1A;&#x4E86;&#x4F7F;&#x7528; kubeadm &#x521B;&#x5EFA;&#x96C6;&#x7FA4;&#x548C;&#x52A0;&#x5165;&#x65B0;&#x7684;&#x8282;&#x70B9;&#xFF0C;&#x5728;&#x672C;&#x7AE0;&#x4E2D;&#xFF0C;&#x5C06;&#x6309;&#x7167; CKAD &#x8BFE;&#x7A0B;&#x7684;&#x65B9;&#x6CD5;&#x91CD;&#x65B0;&#x90E8;&#x7F72;&#x4E00;&#x904D;&#xFF0C;&#x5B9E;&#x9645;&#x4E0A;&#x5B98;&#x65B9;&#x6559;&#x7A0B;&#x7684;&#x5185;&#x5BB9;&#x4E0D;&#x591A;&#xFF0C;&#x7B14;&#x8005;&#x5199;&#x4E86;&#x4E24;&#x7BC7;&#x7C7B;&#x4F3C;&#x7684;&#x90E8;&#x7F72;&#x65B9;&#x5F0F;&#xFF0C;&#x5982;&#x679C;&#x5DF2;&#x7ECF;&#x90E8;&#x7F72;&#x4E86; kubernetes &#x96C6;&#x7FA4;&#xFF0C;&#x5219;&#x672C;&#x7AE0;&#x7684;&#x5185;&#x5BB9;&#x53EF;&#x8DF3;&#x8FC7;&#x3002;</p>
<h2 id="&#x90E8;&#x7F72;"><a name="&#x90E8;&#x7F72;" class="anchor-navigation-ex-anchor" href="#&#x90E8;&#x7F72;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x90E8;&#x7F72;</h2>
<h3 id="&#x9884;&#x8BBE;&#x7F51;&#x7EDC;"><a name="&#x9884;&#x8BBE;&#x7F51;&#x7EDC;" class="anchor-navigation-ex-anchor" href="#&#x9884;&#x8BBE;&#x7F51;&#x7EDC;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x9884;&#x8BBE;&#x7F51;&#x7EDC;</h3>
<p>&#x672C;&#x8282;&#x4E3B;&#x8981;&#x662F;&#x914D;&#x7F6E; hosts &#x6587;&#x4EF6;&#xFF0C;&#x5728;&#x540E;&#x7EED;&#x914D;&#x7F6E;&#x4E2D;&#xFF0C;&#x901A;&#x8FC7;&#x4E3B;&#x673A;&#x540D;&#x79F0;&#x5373;&#x53EF;&#x5FEB;&#x901F;&#x8FDE;&#x63A5;&#xFF0C;&#x800C;&#x4E0D;&#x9700;&#x8981;&#x6BCF;&#x6B21;&#x90FD;&#x6253;&#x4E0A; IP &#x5730;&#x5740;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x5728; Master &#x8282;&#x70B9;&#x670D;&#x52A1;&#x5668;&#x6267;&#x884C; <code>ip addr</code> &#x547D;&#x4EE4;&#xFF0C;&#x627E;&#x5230; <code>ens4</code>&#xFF0C;&#x628A;&#x91CC;&#x9762;&#x63D0;&#x5230;&#x7684; ip &#x8BB0;&#x5F55;&#x4E0B;&#x6765;&#x3002;</p>
<pre class="language-"><code class="lang-bash">ens4: <span class="token operator">&lt;</span>BROADCAST,MULTICAST,UP,LOWER_UP<span class="token operator">&gt;</span> mtu <span class="token number">1460</span> qdisc mq state UP group default qlen <span class="token number">1000</span>
    link/ether <span class="token number">42</span>:01:0a:aa:00:02 brd ff:ff:ff:ff:ff:ff
    inet <span class="token number">10.170</span>.0.2/32 scope global dynamic ens4
       valid_lft 2645sec preferred_lft 2645sec
    inet6 fe80::4001:aff:feaa:2/64 scope <span class="token function">link</span> 
       valid_lft forever preferred_lft forever
</code></pre>
<p>&#x5982;&#x4E0A;&#x8FF0; ip &#x662F; 10.170.0.2&#x3002;&#x6216;&#x8005;&#x4F7F;&#x7528; <code>hostname -i</code> &#x67E5;&#x8BE2;&#x3002;&#x65B9;&#x5F0F;&#x6709;&#x5F88;&#x591A;&#xFF0C;&#x76EE;&#x524D;&#x662F;&#x83B7;&#x5F97;&#x4E3B;&#x673A;&#x7684;&#x5185;&#x7F51; IP&#x3002;</p>
<p>&#x7136;&#x540E;&#x4FEE;&#x6539; <code>/etc/hosts</code> &#x6587;&#x4EF6;&#xFF0C;&#x52A0;&#x4E0A;&#x4E00;&#x884C;&#xFF08;&#x66FF;&#x6362;&#x8FD9;&#x4E2A;ip&#x4E3A;&#x4F60;&#x7684;&#xFF09;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash"><span class="token number">10.170</span>.0.2      k8smaster
</code></pre>
<p>&#x540E;&#x9762;&#x6211;&#x4EEC;&#x8BBF;&#x95EE;&#x96C6;&#x7FA4;&#xFF0C;&#x4F7F;&#x7528; k8smaster &#x8FD9;&#x4E2A;&#x4E3B;&#x673A;&#x540D;&#x79F0;(&#x57DF;&#x540D;)&#xFF0C;&#x800C;&#x4E14;&#x4E0D;&#x662F;&#x9700;&#x8981; IP &#x5730;&#x5740;&#xFF0C;&#x4F7F;&#x7528;&#x4E3B;&#x673A;&#x540D;&#x79F0;&#x65B9;&#x4FBF;&#x8BB0;&#x5FC6;&#xFF0C;&#x4E5F;&#x907F;&#x514D;&#x4E86; IP &#x5F3A;&#x56FA;&#x5B9A;&#x3002;</p>
<h3 id="kubeadm-&#x5B89;&#x88C5;-k8s"><a name="kubeadm-&#x5B89;&#x88C5;-k8s" class="anchor-navigation-ex-anchor" href="#kubeadm-&#x5B89;&#x88C5;-k8s"><i class="fa fa-link" aria-hidden="true"></i></a>kubeadm &#x5B89;&#x88C5; k8s</h3>
<p>&#x8FD9;&#x91CC;&#x7684;&#x90E8;&#x7F72;&#x8FC7;&#x7A0B;&#x8DDF;&#x4E0A;&#x4E00;&#x7AE0;&#x4E2D;&#x7684;&#x6709;&#x6240;&#x5DEE;&#x5F02;&#xFF0C;&#x56E0;&#x4E3A;&#x4E0A;&#x7AE0;&#x4E2D;&#xFF0C;&#x76F4;&#x63A5;&#x4F7F;&#x7528; <code>kubeadm init</code> &#x8FDB;&#x884C;&#x521D;&#x59CB;&#x5316;&#x96C6;&#x7FA4;&#xFF0C;&#x6CA1;&#x6709;&#x914D;&#x7F6E;&#x66F4;&#x591A;&#x7EC6;&#x8282;&#x3002;</p>
<p>&#x6267;&#x884C; <code>kubectl version</code> &#x67E5;&#x770B; k8s &#x7248;&#x672C;&#xFF0C;&#x627E;&#x5230;&#x8FD9;&#x6BB5;<code>GitVersion:&quot;v1.21.0&quot;</code> &#xFF0C;&#x5373;&#x4E3A; Kubernetes &#x7248;&#x672C;&#x3002;</p>
<p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A; kubeadm-config.yaml &#x6587;&#x4EF6;&#xFF0C;&#x6211;&#x4EEC;&#x4F7F;&#x7528; <code>kubeadm init</code> &#x65F6;&#xFF0C;&#x901A;&#x8FC7;&#x6B64;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x51FA;&#x521D;&#x59CB;&#x5316; k8s master&#x3002;</p>
<p>&#x6587;&#x4EF6;&#x5185;&#x5BB9;&#x4E3A;&#xFF1A;</p>
<pre class="language-"><code class="lang-yaml"><span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> kubeadm.k8s.io/v1beta2
<span class="token key atrule">kind</span><span class="token punctuation">:</span> ClusterConfiguration
<span class="token key atrule">kubenetesVersion</span><span class="token punctuation">:</span> 1.21.0
<span class="token key atrule">controlPlaneEndpoint</span><span class="token punctuation">:</span> <span class="token string">&quot;k8smaster:6443&quot;</span>
<span class="token key atrule">networking</span><span class="token punctuation">:</span>
    <span class="token key atrule">podSubnet</span><span class="token punctuation">:</span> 192.168.0.0/16
</code></pre>
<p>&#x6CE8;&#x610F;&#xFF0C;<code>:</code> &#x540E;&#x9762;&#x5FC5;&#x987B;&#x5E26;&#x4E00;&#x4E2A;&#x7A7A;&#x683C;&#x3002;&#x8868;&#x793A;<code>key: value</code>&#x3002;&#x4F8B;&#x5982; <code>image: nginx:letest</code> &#xFF0C;&#x4E0D;&#x5E26;&#x7A7A;&#x683C;&#x7684; <code>:</code> &#x4F1A;&#x8FDE;&#x5728;&#x4E00;&#x8D77;&#x3002;</p>
<p>&#x7136;&#x540E;&#x901A;&#x8FC7;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x521D;&#x59CB;&#x5316; Master&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">kubeadm init --config<span class="token operator">=</span>kubeadm-config.yaml --upload-certs --v<span class="token operator">=</span><span class="token number">5</span> <span class="token operator">|</span> <span class="token function">tee</span> kubeadm-init.out
<span class="token comment"># &#x53EF;&#x7701;&#x7565;&#x4E3A; kubeadm init --config=kubeadm-config.yaml --upload-certs</span>
</code></pre>
<p><code>--v=5</code> &#x53EF;&#x4EE5;&#x8F93;&#x51FA;&#x66F4;&#x591A;&#x4FE1;&#x606F;&#x4FE1;&#x606F;&#xFF0C;<code>tee xxx</code> &#x53EF;&#x4EE5;&#x8BA9;&#x4FE1;&#x606F;&#x8F93;&#x51FA;&#x5230;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x4E2D;&#xFF0C;&#x65B9;&#x4FBF;&#x6536;&#x96C6;&#x65E5;&#x5FD7;&#x6216;&#x8005;&#x540E;&#x7EED;&#x68C0;&#x67E5;&#x3002;</p>
<p>&#x6267;&#x884C;&#x521D;&#x59CB;&#x5316;&#x547D;&#x4EE4;&#x540E;&#xFF0C;&#x7EC8;&#x7AEF;&#x6216;&#x67E5;&#x770B; <code>kubeadm-init.out</code> &#x6587;&#x4EF6;&#xFF0C;&#x6709;&#x4EE5;&#x4E0B;&#x5185;&#x5BB9;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">To start using your cluster, you need to run the following as a regular user:

  <span class="token function">mkdir</span> -p <span class="token environment constant">$HOME</span>/.kube
  <span class="token function">sudo</span> <span class="token function">cp</span> -i /etc/kubernetes/admin.conf <span class="token environment constant">$HOME</span>/.kube/config
  <span class="token function">sudo</span> <span class="token function">chown</span> <span class="token variable"><span class="token variable">$(</span><span class="token function">id</span> -u<span class="token variable">)</span></span><span class="token builtin class-name">:</span><span class="token variable"><span class="token variable">$(</span><span class="token function">id</span> -g<span class="token variable">)</span></span> <span class="token environment constant">$HOME</span>/.kube/config

Alternatively, <span class="token keyword">if</span> you are the root user, you can run:

  <span class="token builtin class-name">export</span> <span class="token assign-left variable">KUBECONFIG</span><span class="token operator">=</span>/etc/kubernetes/admin.conf

You should now deploy a pod network to the cluster.
Run <span class="token string">&quot;kubectl apply -f [podnetwork].yaml&quot;</span> with one of the options listed at:
  https://kubernetes.io/docs/concepts/cluster-administration/addons/

You can now <span class="token function">join</span> any number of the control-plane node running the following <span class="token builtin class-name">command</span> on each as root:

  kubeadm <span class="token function">join</span> k8smaster:6443 --token 45td1j.xqdscm4k06a4edi2 <span class="token punctuation">\</span>
    --discovery-token-ca-cert-hash sha256:aeb772c57a35a283716b65d16744a71250bcc25d624010ccb89090021ca0f428 <span class="token punctuation">\</span>
    --control-plane --certificate-key d76287ccc4701db9d34e0c9302fa285be2e9241fc43c94217d6beb419cdf3c52

Please note that the certificate-key gives access to cluster sensitive data, keep it secret<span class="token operator">!</span>
As a safeguard, uploaded-certs will be deleted <span class="token keyword">in</span> two hours<span class="token punctuation">;</span> If necessary, you can use
<span class="token string">&quot;kubeadm init phase upload-certs --upload-certs&quot;</span> to reload certs afterward.

Then you can <span class="token function">join</span> any number of worker nodes by running the following on each as root:

kubeadm <span class="token function">join</span> k8smaster:6443 --token 45td1j.xqdscm4k06a4edi2 <span class="token punctuation">\</span>
    --discovery-token-ca-cert-hash sha256:aeb772c57a35a283716b65d16744a71250bcc25d624010ccb89090021ca0f428
</code></pre>
<p>&#x6309;&#x7167;&#x63D0;&#x793A;&#xFF0C;&#x6211;&#x4EEC;<strong>&#x9010;&#x4E2A;&#x6267;&#x884C;</strong>&#x4E0B;&#x9762;&#x7684;&#x547D;&#x4EE4;&#xFF0C;&#x4E0D;&#x8981;&#x4E00;&#x6B21;&#x6027;&#x7C98;&#x8D34;&#x6267;&#x884C;&#xFF0C;&#x56E0;&#x4E3A; <code>cp -i</code> &#x8868;&#x793A;&#x8981;&#x4F60;&#x8F93;&#x5165; <code>y/n</code> &#x786E;&#x8BA4;&#x66F4;&#x6539;&#xFF0C;&#x4E00;&#x6B21;&#x6027;&#x7C98;&#x8D34;&#x4F1A;&#x5BFC;&#x81F4;&#x8DF3;&#x8FC7;(&#x628A; -i &#x6539;&#x4E3A; -f &#x4E5F;&#x884C;)&#x3002;</p>
<pre class="language-"><code>  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config
</code></pre><p>&#x7136;&#x540E;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash"><span class="token builtin class-name">export</span> <span class="token assign-left variable">KUBECONFIG</span><span class="token operator">=</span>/etc/kubernetes/admin.conf
</code></pre>
<p>&#x7B14;&#x8005;&#x6CE8;&#xFF1A;<code>KUBECONFIG</code> &#x73AF;&#x5883;&#x53D8;&#x91CF;&#x5728;&#x4E0B;&#x6B21;&#x767B;&#x5F55;&#x6216;&#x65B0;&#x5EFA;&#x7EC8;&#x7AEF;&#x7A97;&#x53E3;&#x4F1A;&#x5931;&#x6548;&#xFF0C;&#x6253;&#x5F00; &#x7528;&#x6237;&#x76EE;&#x5F55;&#x7684;<code>.bashrc</code> &#x6587;&#x4EF6;&#xFF0C;&#x5728;&#x6700;&#x540E;&#x9762;&#x52A0;&#x4E0A; <code>export KUBECONFIG=/etc/kubernetes/admin.conf</code> &#xFF0C;&#x53EF;&#x4FDD;&#x8BC1;&#x4E0B;&#x6B21;&#x767B;&#x5F55;&#x6216;&#x5207;&#x6362;&#x7EC8;&#x7AEF;&#xFF0C;&#x4F9D;&#x7136;&#x53EF;&#x7528;&#x3002;</p>
<p>&#x7B14;&#x8005;&#x6CE8;&#xFF1A;&#x56E0;&#x4E3A;&#x6D89;&#x53CA;&#x5230;&#x591A;&#x7528;&#x6237;&#xFF0C;&#x6240;&#x4EE5;&#x5982;&#x679C;&#x5207;&#x6362;&#x7528;&#x6237;&#xFF0C;&#x5C31;&#x4E0D;&#x80FD;&#x4F7F;&#x7528; <code>kubeadm/kubectl/kubelet</code> &#x547D;&#x4EE4;&#x4E86;&#xFF0C;&#x5982;&#x679C;&#x8BFB;&#x8005;&#x5207;&#x6362;&#x4E86;&#x7528;&#x6237;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x6267;&#x884C;&#x4E0A;&#x9762; <code>make -p $HOME/.kube</code> &#x5230; <code>export xxx</code> &#x8FD9;&#x4E24;&#x90E8;&#x5206;&#x7684;&#x547D;&#x4EE4;&#xFF0C;&#x8FD9;&#x6837;&#x522B;&#x7684;&#x7528;&#x6237;&#x4E5F;&#x53EF;&#x4EE5;&#x6267;&#x884C;&#x547D;&#x4EE4;&#x64CD;&#x4F5C;&#x8282;&#x70B9;&#x3002;</p>
<p>&#x8F93;&#x5165; <code>kubeadm config print init-default</code> &#x53EF;&#x4EE5;&#x67E5;&#x770B;&#x5230; master &#x521D;&#x59CB;&#x5316;&#x65F6;&#x914D;&#x7F6E;&#x3002;</p>
<p>&#x4EE5;&#x4E0A;&#x4FBF;&#x662F; CKAD &#x5B98;&#x65B9;&#x7684;&#x90E8;&#x7F72;&#x65B9;&#x6CD5;&#x3002;</p>
<h2 id="&#x914D;&#x7F6E;-calico"><a name="&#x914D;&#x7F6E;-calico" class="anchor-navigation-ex-anchor" href="#&#x914D;&#x7F6E;-calico"><i class="fa fa-link" aria-hidden="true"></i></a>&#x914D;&#x7F6E; Calico</h2>
<h4 id="&#x4EC0;&#x4E48;&#x662F;-cni"><a name="&#x4EC0;&#x4E48;&#x662F;-cni" class="anchor-navigation-ex-anchor" href="#&#x4EC0;&#x4E48;&#x662F;-cni"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4EC0;&#x4E48;&#x662F; CNI</h4>
<p>CNI &#x610F;&#x4E3A;&#x5BB9;&#x5668;&#x7F51;&#x7EDC;&#x63A5;&#x53E3;&#xFF0C;&#x662F; Kubernetes &#x7684;&#x4E00;&#x79CD;&#x6807;&#x51C6;&#x8BBE;&#x8BA1;&#xFF0C;&#x4F7F;&#x7528;&#x8005;&#x53EF;&#x4EE5;&#x4E0D;&#x9700;&#x8981;&#x5173;&#x6CE8;&#x4F7F;&#x7528;&#x4E86;&#x4F55;&#x79CD;&#x7F51;&#x7EDC;&#x63D2;&#x4EF6;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x63D2;&#x4EF6;&#x6216;&#x9500;&#x6BC1;&#x5BB9;&#x5668;&#x65F6;&#x66F4;&#x52A0;&#x5BB9;&#x6613;&#x5730;&#x914D;&#x7F6E;&#x7F51;&#x7EDC;&#x3002;</p>
<p>Kubernetes &#x4E2D;&#x6709; Flannel&#x3001;Calico&#x3001;Weave &#x7B49;&#x4E3B;&#x6D41;&#x7684;&#x63D2;&#x4EF6;&#xFF0C;&#x5728;&#x4E0A;&#x4E00;&#x7BC7;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x90E8;&#x7F72; Kubernetes &#x7F51;&#x7EDC;&#x65F6;&#xFF0C;&#x4F7F;&#x7528;&#x4E86; Weave&#xFF0C;&#x800C;&#x5728;&#x672C;&#x7AE0;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x5C06;&#x4F7F;&#x7528; Calico &#x6765;&#x90E8;&#x7F72;&#x7F51;&#x7EDC;&#x3002;</p>
<p>&#x5BF9;&#x4E8E; CNI &#xFF0C;&#x540E;&#x9762;&#x7684;&#x7AE0;&#x8282;&#x4F1A;&#x6DF1;&#x5165;&#x5B66;&#x4E60;&#x3002;</p>
<p>Calico(<a href="https://github.com/projectcalico/calico" target="_blank">https://github.com/projectcalico/calico</a>) &#x662F;&#x9488;&#x5BF9;&#x5BB9;&#x5668;&#x3001;&#x865A;&#x62DF;&#x673A;&#x548C;&#x88F8;&#x673A;&#x5DE5;&#x4F5C;&#x8D1F;&#x8F7D;&#x7684;&#x5F00;&#x6E90;&#x7F51;&#x7EDC;&#x548C;&#x5B89;&#x5168;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#xFF0C;&#x5B83;&#x63D0;&#x4F9B;&#x4E86; Pod &#x4E4B;&#x95F4;&#x7684;&#x7F51;&#x7EDC;&#x8FDE;&#x63A5;&#x548C;&#x7F51;&#x7EDC;&#x5B89;&#x5168;&#x7B56;&#x7565;&#x5B9E;&#x65BD;&#x3002;</p>
<p>Flannel&#x3001;Calico&#x3001;Weave &#x90FD;&#x662F;&#x5E38;&#x7528;&#x7684; Kubernetes &#x7F51;&#x7EDC;&#x63D2;&#x4EF6;&#xFF0C;&#x8BFB;&#x8005;&#x53EF;&#x53C2;&#x8003; <a href="https://kubernetes.io/zh/docs/concepts/cluster-administration/networking/" target="_blank">https://kubernetes.io/zh/docs/concepts/cluster-administration/networking/</a> &#x8FD9;&#x91CC;&#x4E0D;&#x505A;&#x8FC7;&#x591A;&#x7684;&#x8BF4;&#x660E;&#x3002;</p>
<p>&#x9996;&#x5148;&#x4E0B;&#x8F7D; Calico &#x7684; yaml &#x6587;&#x4EF6;&#x3002;</p>
<pre class="language-"><code>wget https://docs.projectcalico.org/manifests/calico.yaml
</code></pre><p>&#x7136;&#x540E;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x7559;&#x610F; yaml &#x6587;&#x4EF6;&#x4E2D;&#x7684; <code>CALICO_IPV4POOL_CIDR</code> &#x7684;&#x503C;&#xFF0C;&#x8BFB;&#x8005;&#x76F4;&#x63A5;&#x6253;&#x5F00; <a href="https://docs.projectcalico.org/manifests/calico.yaml" target="_blank">https://docs.projectcalico.org/manifests/calico.yaml</a> &#x6216;&#x8005;&#x4F7F;&#x7528; <code>less calico.yaml</code> &#x5728;&#x7EC8;&#x7AEF;&#x4E0A;&#x9605;&#x8BFB;&#x6587;&#x4EF6;&#x3002;</p>
<p>&#x627E;&#x5230; <code>CALICO_IPV4POOL_CIDR</code> &#x4F8B;&#x5982;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">         <span class="token comment"># - name: CALICO_IPV4POOL_CIDR</span>
            <span class="token comment">#   value: &quot;192.168.0.0/16&quot;</span>
</code></pre>
<p>&#x8FD9;&#x4E2A;&#x8868;&#x793A; ip4 &#x6C60;&#xFF0C;&#x5982;&#x679C; ip &#x4E0D;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x4F1A;&#x81EA;&#x52A8;&#x521B;&#x5EFA;&#xFF0C;&#x521B;&#x5EFA; &#x7684; pod &#x7684;&#x7F51;&#x7EDC; ip &#x4F1A;&#x5728;&#x8FD9;&#x4E2A;&#x8303;&#x56F4;&#x3002;&#x9ED8;&#x8BA4;&#x662F; <code>192.168.0.0</code> &#x6211;&#x4EEC;&#x4E0D;&#x9700;&#x8981;&#x6539;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x9700;&#x8981;&#x5B9A;&#x5236;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x5220;&#x9664; <code>#</code> &#xFF0C;&#x7136;&#x540E;&#x6539;&#x52A8; ip&#x3002;</p>
<blockquote>
<p><strong>[Error] &#x63D0;&#x793A;</strong></p>
<p>&#x8BF7;&#x52A1;&#x5FC5;&#x6839;&#x636E;&#x4F60;&#x96C6;&#x7FA4;&#x4E2D;&#x7684; IP &#x6BB5;&#xFF0C;&#x914D;&#x7F6E;&#x6B64;&#x53C2;&#x6570;&#x3002;</p>
</blockquote>
<p>&#x7136;&#x540E;&#x6211;&#x4EEC;&#x542F;&#x7528; Calico &#x7F51;&#x7EDC;&#x63D2;&#x4EF6;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">kubectl apply -f calico.yaml
</code></pre>
<p>&#x5F53;&#x7F51;&#x7EDC;&#x914D;&#x7F6E;&#x5B8C;&#x6210;&#x540E;&#xFF0C;&#x5373;&#x53EF;&#x4F7F;&#x7528; <code>kubeadm join</code> &#x52A0;&#x5165;&#x8282;&#x70B9;&#x3002;</p>
<h2 id="&#x5176;&#x5B83;"><a name="&#x5176;&#x5B83;" class="anchor-navigation-ex-anchor" href="#&#x5176;&#x5B83;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5176;&#x5B83;</h2>
<h3 id="&#x5728;&#x8282;&#x70B9;&#x4E0A;&#x6267;&#x884C;&#x547D;&#x4EE4;"><a name="&#x5728;&#x8282;&#x70B9;&#x4E0A;&#x6267;&#x884C;&#x547D;&#x4EE4;" class="anchor-navigation-ex-anchor" href="#&#x5728;&#x8282;&#x70B9;&#x4E0A;&#x6267;&#x884C;&#x547D;&#x4EE4;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5728;&#x8282;&#x70B9;&#x4E0A;&#x6267;&#x884C;&#x547D;&#x4EE4;</h3>
<p>&#x5982;&#x679C;&#x6211;&#x4EEC;&#x5728; Worker &#x8282;&#x70B9;&#x4E0A;&#x6267;&#x884C;&#x547D;&#x4EE4;&#xFF0C;&#x4F1A;&#x53D1;&#x73B0;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">root@instance-2:~<span class="token comment"># kubectl describe nodes</span>
The connection to the server localhost:8080 was refused - did you specify the right <span class="token function">host</span> or port?
</code></pre>
<p>&#x9996;&#x5148;&#x5728; Master &#x8282;&#x70B9;&#x4E2D;&#xFF0C;&#x4E0B;&#x8F7D; <code>/etc/kubernetes/admin.conf</code> &#x6587;&#x4EF6;&#xFF0C;&#x6216;&#x8005;&#x590D;&#x5236;&#x6587;&#x4EF6;&#x5185;&#x5BB9;&#xFF0C;&#x5230; Worker &#x8282;&#x70B9;&#x4E2D;&#x3002;</p>
<p>&#x5C06;&#x6587;&#x4EF6;&#x4E0A;&#x4F20;&#x6216;&#x590D;&#x5236;&#x5230; Worker &#x8282;&#x70B9;&#x7684; <code>/etc/kubernetes/admin.conf</code> &#x6587;&#x4EF6;&#xFF0C;&#x6267;&#x884C;&#x914D;&#x7F6E;&#x5373;&#x53EF;&#x3002;</p>
<pre class="language-"><code class="lang-bash">  <span class="token function">mkdir</span> -p <span class="token environment constant">$HOME</span>/.kube
  <span class="token function">sudo</span> <span class="token function">cp</span> -f /etc/kubernetes/admin.conf <span class="token environment constant">$HOME</span>/.kube/config
  <span class="token function">sudo</span> <span class="token function">chown</span> <span class="token variable"><span class="token variable">$(</span><span class="token function">id</span> -u<span class="token variable">)</span></span><span class="token builtin class-name">:</span><span class="token variable"><span class="token variable">$(</span><span class="token function">id</span> -g<span class="token variable">)</span></span> <span class="token environment constant">$HOME</span>/.kube/config
</code></pre>
<pre class="language-"><code class="lang-bash"><span class="token builtin class-name">export</span> <span class="token assign-left variable">KUBECONFIG</span><span class="token operator">=</span>/etc/kubernetes/admin.conf
</code></pre>
<pre class="language-"><code class="lang-bash"><span class="token builtin class-name">echo</span> <span class="token string">&apos;export KUBECONFIG=/etc/kubernetes/admin.conf&apos;</span> <span class="token operator">&gt;&gt;</span> <span class="token environment constant">$HOME</span>/.bashrc
</code></pre>
<h3 id="&#x81EA;&#x52A8;&#x8865;&#x5168;&#x5DE5;&#x5177;"><a name="&#x81EA;&#x52A8;&#x8865;&#x5168;&#x5DE5;&#x5177;" class="anchor-navigation-ex-anchor" href="#&#x81EA;&#x52A8;&#x8865;&#x5168;&#x5DE5;&#x5177;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x81EA;&#x52A8;&#x8865;&#x5168;&#x5DE5;&#x5177;</h3>
<p><code>kubectl</code> &#x547D;&#x4EE4;&#x548C;&#x53EF;&#x9009;&#x53C2;&#x6570;&#x975E;&#x5E38;&#x591A;&#xFF0C;&#x6BCF;&#x6B21;&#x90FD;&#x8981;&#x6572;&#x957F;&#x957F;&#x7684;&#x547D;&#x4EE4;&#xFF0C;&#x5BB9;&#x6613;&#x51FA;&#x9519;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5229;&#x7528; <code>bash-completion</code> &#x4E3A;&#x6211;&#x4EEC;&#x5FEB;&#x901F;&#x5B8C;&#x6210;&#x547D;&#x4EE4;&#x7684;&#x8F93;&#x5165;&#x3002;</p>
<pre class="language-"><code class="lang-bash"><span class="token function">sudo</span> <span class="token function">apt-get</span> <span class="token function">install</span> bash-completion -y
</code></pre>
<pre class="language-"><code class="lang-bash"><span class="token builtin class-name">source</span> <span class="token operator">&lt;</span><span class="token punctuation">(</span>kubectl completion <span class="token function">bash</span><span class="token punctuation">)</span>
<span class="token builtin class-name">echo</span> <span class="token string">&quot;source &lt;(kubectl completion bash)&quot;</span> <span class="token operator">&gt;&gt;</span> <span class="token environment constant">$HOME</span>/.bashrc
</code></pre>
<p>&#x5F53;&#x6211;&#x4EEC;&#x6572;&#x547D;&#x4EE4;&#x65F6;&#xFF0C;&#x6309;&#x4E0B; TAB &#x952E;&#xFF0C;&#x4F1A;&#x81EA;&#x52A8;&#x8865;&#x5168;&#x3002;</p>
<p>&#x8F93;&#x5165; <code>kubectl des</code> &#xFF0C;&#x7136;&#x540E;&#x6309;&#x4E00;&#x4E0B; <code>TAB</code> &#x952E;&#xFF0C;&#x4F1A;&#x53D1;&#x73B0;&#x5185;&#x5BB9;&#x81EA;&#x52A8;&#x8865;&#x5168;&#x4E3A; <code>kubectl describe</code>&#x3002;</p>
<h3 id="&#x72B6;&#x6001;&#x63CF;&#x8FF0;"><a name="&#x72B6;&#x6001;&#x63CF;&#x8FF0;" class="anchor-navigation-ex-anchor" href="#&#x72B6;&#x6001;&#x63CF;&#x8FF0;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x72B6;&#x6001;&#x63CF;&#x8FF0;</h3>
<p>&#x6267;&#x884C; <code>kubectl describe nodes</code> /&#x547D;&#x4EE4;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x8282;&#x70B9;&#x8BE6;&#x7EC6;&#x7684;&#x4FE1;&#x606F;&#xFF0C;&#x5176;&#x4E2D;&#x6709;&#x4E2A; <code>Conitions</code> &#x5B57;&#x6BB5;&#xFF0C;&#x63CF;&#x8FF0;&#x4E86;&#x6240;&#x6709;&#x6B63;&#x5728;&#x8FD0;&#x884C;&#x4E2D;(Running) &#x7684;&#x8282;&#x70B9;&#x7684;&#x72B6;&#x6001;&#xFF0C;&#x5B83;&#x6709; 5 &#x4E2A;&#x5B57;&#x6BB5;&#x6216;&#x7C7B;&#x578B;&#xFF1A;</p>
<ul>
<li><p>Ready</p>
<p>Node &#x662F;&#x5426;&#x80FD;&#x591F;&#x63A5;&#x6536; pod &#xFF0C;&#x5982;&#x679C;&#x53EF;&#x4EE5;&#x5219; <code>Status</code> &#x4E3A; True&#xFF1B;&#x5982;&#x679C;&#x8282;&#x70B9;&#x4E0D;&#x5065;&#x5EB7;&#xFF0C;&#x4E0D;&#x80FD;&#x63A5;&#x6536; pod&#xFF0C;&#x5219; &#x4E3A; False&#x3002;&#x6B63;&#x5E38;&#x60C5;&#x51B5;&#x4E0B;&#x4E3A; True&#x3002;</p>
</li>
<li><p>DiskPressure</p>
<p>&#x8868;&#x793A;&#x8282;&#x70B9;&#x7684;&#x7A7A;&#x95F2;&#x7A7A;&#x95F4;&#x4E0D;&#x8DB3;&#x4EE5;&#x7528;&#x4E8E;&#x6DFB;&#x52A0;&#x65B0; Pod&#xFF0C;&#x5982;&#x679C;&#x4E3A; True&#x5219;&#x8BF4;&#x660E;&#x4E0D;&#x6B63;&#x5E38;&#x3002;</p>
</li>
<li><p>MemoryPressure</p>
<p>&#x8868;&#x793A;&#x8282;&#x70B9;&#x5B58;&#x5728;&#x5185;&#x5B58;&#x538B;&#x529B;&#xFF0C;&#x5373;&#x8282;&#x70B9;&#x5185;&#x5B58;&#x53EF;&#x7528;&#x91CF;&#x4F4E;&#xFF0C;&#x5982;&#x679C;&#x4E3A; True &#x5219;&#x8BF4;&#x660E;&#x4E0D;&#x6B63;&#x5E38;&#x3002;</p>
</li>
<li><p>PIDPressure</p>
<p>&#x8868;&#x793A;&#x8282;&#x70B9;&#x5B58;&#x5728;&#x8FDB;&#x7A0B;&#x538B;&#x529B;&#xFF0C;&#x5373;&#x8282;&#x70B9;&#x4E0A;&#x8FDB;&#x7A0B;&#x8FC7;&#x591A;&#xFF1B;&#x5982;&#x679C;&#x4E3A; True &#x5219;&#x8BF4;&#x660E;&#x4E0D;&#x6B63;&#x5E38;&#x3002;</p>
</li>
<li><p>NetworkUnavailable</p>
<p>&#x8868;&#x793A;&#x8282;&#x70B9;&#x7F51;&#x7EDC;&#x914D;&#x7F6E;&#x4E0D;&#x6B63;&#x786E;&#xFF1B;&#x5982;&#x679C;&#x4E3A; True&#xFF0C;&#x5219;&#x8BF4;&#x660E;&#x4E0D;&#x6B63;&#x5E38;&#x3002;</p>
</li>
</ul>
<p>&#x5982;&#x679C;&#x4F7F;&#x7528; JSON &#x8868;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-javascript"><span class="token string">&quot;conditions&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
  <span class="token punctuation">{</span>
    <span class="token string">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;Ready&quot;</span><span class="token punctuation">,</span>
    <span class="token string">&quot;status&quot;</span><span class="token operator">:</span> <span class="token string">&quot;True&quot;</span><span class="token punctuation">,</span>
    <span class="token string">&quot;reason&quot;</span><span class="token operator">:</span> <span class="token string">&quot;KubeletReady&quot;</span><span class="token punctuation">,</span>
    <span class="token string">&quot;message&quot;</span><span class="token operator">:</span> <span class="token string">&quot;kubelet is posting ready status&quot;</span><span class="token punctuation">,</span>
    <span class="token string">&quot;lastHeartbeatTime&quot;</span><span class="token operator">:</span> <span class="token string">&quot;2019-06-05T18:38:35Z&quot;</span><span class="token punctuation">,</span>
    <span class="token string">&quot;lastTransitionTime&quot;</span><span class="token operator">:</span> <span class="token string">&quot;2019-06-05T11:41:27Z&quot;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">]</span>
</code></pre>
<p>&#x8BFB;&#x8005;&#x53EF;&#x53C2;&#x8003;&#xFF1A;<a href="https://kubernetes.io/zh/docs/concepts/architecture/nodes/" target="_blank">https://kubernetes.io/zh/docs/concepts/architecture/nodes/</a></p>
<p>&#x672C;&#x7AE0;&#x5185;&#x5BB9;&#x4E3B;&#x8981;&#x4ECB;&#x7ECD;&#x4E86; CKAD &#x8BA4;&#x8BC1;&#x4E2D;&#x8981;&#x6C42;&#x638C;&#x63E1;&#x7684; kubeadm &#x90E8;&#x7F72; k8s &#x3001;&#x914D;&#x7F6E;&#x542F;&#x52A8; Calico &#x7F51;&#x7EDC;&#x63D2;&#x4EF6;&#xFF0C;&#x8DDF;&#x4E0A;&#x4E00;&#x7BC7;&#x7684;&#x5185;&#x5BB9;&#x6BD4;&#x8F83;&#xFF0C;&#x4E3B;&#x8981;&#x662F;&#x901A;&#x8FC7; yaml &#x6587;&#x4EF6;&#x53BB;&#x63A7;&#x5236;&#x521B;&#x5EFA; kubernetes &#x96C6;&#x7FA4;&#xFF0C;&#x4E24;&#x7AE0;&#x7684;&#x90E8;&#x7F72;&#x8FC7;&#x7A0B;&#x4E00;&#x81F4;&#xFF0C;&#x53EA;&#x662F;&#x7F51;&#x7EDC;&#x63D2;&#x4EF6;&#x6709;&#x6240;&#x4E0D;&#x540C;&#x3002;</p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; &#x75F4;&#x8005;&#x5DE5;&#x826F; 2021 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x6587;&#x6863;&#x6700;&#x540E;&#x66F4;&#x65B0;&#x65F6;&#x95F4;&#xFF1A;
2021-11-03 21:26:26
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="2.kubeadm.html" class="navigation navigation-prev " aria-label="Previous page: 2.2 使用 kubeadm 部署">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="4.kubeadm_proxy.html" class="navigation navigation-next " aria-label="Next page: 2.4 国内代理">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"2.3 CKAD认证中的部署教程","level":"1.3.4","depth":2,"next":{"title":"2.4 国内代理","level":"1.3.5","depth":2,"path":"2.deploy/4.kubeadm_proxy.md","ref":"2.deploy/4.kubeadm_proxy.md","articles":[]},"previous":{"title":"2.2 使用 kubeadm 部署","level":"1.3.3","depth":2,"path":"2.deploy/2.kubeadm.md","ref":"2.deploy/2.kubeadm.md","articles":[]},"dir":"ltr"},"config":{"plugins":["tbfed-pagefooter","anchor-navigation-ex","mermaid-gb3","insert-logo","chapter-fold","advanced-emoji","github","splitter","alerts","popup","prism","-highlight","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy 痴者工良 2021","modify_label":"文档最后更新时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"prism":{"lang":{"flow":"typescript","shell":"bash"},"ignore":["mermaid","eval-js"],"css":["prismjs/themes/prism.css"],"js":["prismjs/prism.js","prismjs/components.js","prismjs/components/prism-go.min.js","prismjs/components/prism-yaml.min.js","prismjs/components/prism-bash.min.js","prismjs/components/prism-shell-session.min.js"]},"github":{"url":"https://github.com/whuanle/kubernetes"},"livereload":{},"splitter":{},"search":{},"popup":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":false,"showLevel":false},"alerts":{},"advanced-emoji":{"embedEmojis":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"insert-logo":{"style":"background: none; max-height: 50px; min-height: 50px","url":"/images/logo.jpg"}},"theme":"default","author":"痴者工良","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Kubernetes - 痴者工良","language":"zh-hans","links":{"sidebar":{"痴者工良的博客":"https://www.whuanle.cn"}},"gitbook":"*","description":"这是一本关于 Kubernetes 的书，作者 痴者工良"},"file":{"path":"2.deploy/3.kubeadm_ckad.md","mtime":"2021-11-03T13:26:26.154Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-11-16T23:21:22.294Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-insert-logo/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-alerts/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    <script src="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>

    </body>
</html>

